package org.travel.travel2gether.domain;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Index;
import org.hibernate.annotations.Table;
import org.hibernate.validator.constraints.Length;

@Entity
@SuppressWarnings(value = "serial")
@Table(appliesTo = "Track", indexes = @Index(name = "IDX_TRACK", 
	columnNames = {"START_ID", "END_ID", "TRAVEL_DATE" }))
public class Track extends BaseEntity {
	
	@Column(name = "START_ID")
	@NotNull(message = "{track.startId.notNull}")
	private String startId;
	
	@Column(name = "END_ID")
	@NotNull(message = "{track.endId.notNull}")
	private String endId;
	
	@ManyToOne
	@NotNull
	private Account account;
	
	@ManyToOne
	private Car car;
	
	//@NotNull
	@Column(name = "TRAVEL_DATE")
	@Temporal(TemporalType.DATE)
	private Date travelDate;
	
	private int seats;
	
	private float price;
	
	@Length(max = 2000)
	@Column(length = 2000)
	private String description;
	
	@Embedded
	private Contact contact;

	public int getSeats() {
		return seats;
	}

	public void setSeats(int seats) {
		this.seats = seats;
	}

	public String getStartId() {
		return startId;
	}

	public void setStartId(String startId) {
		this.startId = startId;
	}

	public String getEndId() {
		return endId;
	}

	public void setEndId(String endId) {
		this.endId = endId;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}

	public Car getCar() {
		return car;
	}

	public void setCar(Car car) {
		this.car = car;
	}

	public Date getTravelDate() {
		return travelDate;
	}

	public void setTravelDate(Date travelDate) {
		this.travelDate = travelDate;
	}

	public float getPrice() {
		return price;
	}

	public void setPrice(float price) {
		this.price = price;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Contact getContact() {
		return contact;
	}

	public void setContact(Contact contact) {
		this.contact = contact;
	}
}
